<?php
$workNum = 5;

$pool = new \Swoole\Process\Pool($workNum);

$pool->on('WorkerStart', function(\Swoole\Process\Pool $pool, $workerId){
    echo "工作进程：{$workerId}, pid: " . posix_getpid() . " 开始运行！", PHP_EOL;
//    while(1);
});

$pool->on("WorkerStop", function(\Swoole\Process\Pool $pool, $workerId){
    echo "工作进程：{$workerId}, pid: " . posix_getpid() . " 结束运行！", PHP_EOL;
});

$pool->start();